function [rfdata] = funcResolveSensorData(array_mask_idx, sensor_data)
% resolve the RF data from the original results of k-wave with given array_mask_idx.
%
% # Args:
% - array_mask_idx: the matrix which stores the index information of the array.
% - sensor_data: the original results of k-wave.
%
% # Results:
% - rfdata: the resolved RF data.
%
    idx_vec = array_mask_idx(array_mask_idx ~= 0);
    assert(numel(idx_vec) == size(sensor_data, 1));

    rfdata = zeros(size(sensor_data, 2), max(idx_vec));
    for i = 1 : max(idx_vec)
        rfdata(:, i) = sum(sensor_data(idx_vec == i, :), 1);
    end
end
